package com.redistest.seckill.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.redistest.seckill.mapper.GoodsMapper;
import com.redistest.seckill.pojo.Goods;
import com.redistest.seckill.pojo.User;
import com.redistest.seckill.service.IGoodsService;
import com.redistest.seckill.vo.GoodsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2025-04-11
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public List<GoodsVo> findGoodsVo() {
        List<GoodsVo> goodsVoList = goodsMapper.findGoodsVo();
        return goodsVoList;
    }

    @Override
    public GoodsVo goodsDetail(Long id) {
        GoodsVo goodsVo = goodsMapper.GoodsVoDetail(id) ;
        return goodsVo;
    }

    @Override
    public boolean updateGoodsVo(GoodsVo goods) {
        if (goods == null || goods.getId() == null) {
            return false;
        }
        return goodsMapper.updateByGoodsVo(goods)> 0;
    }
}
